const express = require('express')
var bodyParser = require('body-parser')
const cors = require('cors')
const app = new express()

var corsOptions = {
    origin: 'http://localhost:8080'
}
app.use(cors(corsOptions))
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())

const db = require('./app/models')
db.sequelize.sync()

app.post('/index', (req, res) => {
    res.json({ message: '你好233' })
})
require('./app/routers/turtorial.router')(app)

const PORT = 3000
app.listen(PORT, () => {
    console.log('运行成功:', PORT)
})
